﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

using Owlpal.Core;
using Owlpal.Blogs.ModelBinders;
using Owlpal.Blogs.Models;

namespace Owlpal.Blogs
{
    public class BlogsInstaller : IPluginInstaller
    {
        public void RegisterBinders(ModelBinderDictionary binder)
        {
            binder.Add(typeof(Blog), new BlogBinder());
            binder.Add(typeof(Category), new CategoryBinder());
            binder.Add(typeof(Comment), new CommentBinder());
            binder.Add(typeof(Entry), new EntryBinder());
            binder.Add(typeof(Tag), new TagBinder());
            binder.Add(typeof(Trackback), new TrackbackBinder());  
        }

        public void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default",                                              // Route name
                "{controller}/{action}/{id}",                           // URL with parameters
                new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
            );
        }
    }
}
